from Signals import Signal
from gobject import GObject, SIGNAL_RUN_LAST, TYPE_NONE, TYPE_PYOBJECT

class Manager(Signal):
	__gsignals__ = {
			"update": (SIGNAL_RUN_LAST, TYPE_NONE, (TYPE_PYOBJECT,)),
			"show-window": (SIGNAL_RUN_LAST, TYPE_NONE, ()),
			"hide-window": (SIGNAL_RUN_LAST, TYPE_NONE, ()),
			"loaded-file": (SIGNAL_RUN_LAST, TYPE_NONE, ()),
		}
		
	def __init__(self, editor):
		Signal.__init__(self)
		from Ctags import Ctags
		Ctags(self, editor)
		from os.path import join, split
		current_folder = split(globals()["__file__"])[0]
		glade_file = join(current_folder, "DocumentBrowser.glade")
		from gtk.glade import XML
		self.__glade = XML(glade_file, "Window", "scribes")
		from Window import Window
		Window(editor, self)
		from TreeView import TreeView
		TreeView(editor, self)
		return

	glade = property(lambda self: self.__glade)
	
	def destroy(self):
		self.emit("destroy")
		del self
		return False

	def activate(self):
		self.emit("activate")
		return False

	def show(self, data):
		self.emit("update", data)
		self.emit("show-window")
		return
